package com.zcy.service.spi;

import java.io.Serializable;
import java.util.List;

import com.zcy.entity.IEntity;
import com.zcy.repository.spi.IDao;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification;


public interface IService<T extends IEntity,PK extends Serializable> {
	public IDao<T,PK> getDao();
	
	public T findOne(PK pk);
	public T findOne(Specification<T> spec);
	
	public Iterable<T> findAll();
	public Iterable<T> findAll(Iterable<PK> pks);
	public Page<T> findAll(Pageable pageable);
	public Iterable<T> findAll(Sort sort);
	public List<T> findAll(Specification<T> spec);
	public Page<T> findAll(Specification<T> spec, Pageable pageable);
	public List<T> findAll(Specification<T> spec, Sort sort);
	public long count();
	public long count(Specification<T> spec);
	
	public void delete(Iterable<T> entitys);
	public void delete(PK pk);
	public void delete(T entity);
	public void deleteAll();
	public void delete(PK[] pk);
	
	public T save(T entity);
	public Iterable<T> save(Iterable<T> entitys);
	
	public boolean exists(PK pk);
	
	
}
